package com.orchidea.uml.manager.command
{
    import com.orchidea.uml.model.document.Document;
    import com.orchidea.uml.orchidea_internal;

    public class UpdateDocumentCommand implements IUndoable
    {
        use namespace orchidea_internal;
        
        private var _timestamp : Date;

        private var document:Document;
        private var title:String;

        public function get timestamp( ) : Date { return _timestamp; }
		public function get description( ) : String { return "Update document"; }

        public function UpdateDocumentCommand(document:Document, title:String)
        {
            this.document = document;
            this.title = title;
        }

        public function execute( ) : void
        {
//			undoSnapshot = document.createSnapshot();
			
			document.setTitle(title);
//			document.setText(text);

			if ( _timestamp == null )
            {
				// don't overwrite the timestamp on redo
				_timestamp = new Date();
			}
		}

        public function undo( ) : void
        {
        }

        public function redo( ) : void
        {
            execute();
        }
    }
}